/**
 * Copyright 2011 Honeywell Federal Manufacturing & Technologies, LLC. This material was produced under U.S. Government
 * contract DE-ACO4-01AL66850, Honeywell Federal Manufacturing & Technologies, LLC, (FM&T) with the U. S. Department of
 * Energy for the operation of the Kansas City Plant . The U.S. Government has rights to use, reproduce, and distribute
 * this software.  NEITHER THE GOVERNMENT NOR Honeywell Federal Manufacturing & Technologies, LLC, MAKES ANY WARRANTY,
 * EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.  If software is modified to produce
 * derivative works, such modified software should be clearly marked, so as not to confuse it with the version available
 * from FM&T.
 *
 * Additionally, this program is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License Version 3 published by the Free Software Foundation. Accordingly, this program is distributed in
 * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this library.
 * If not, see http://www.gnu.org/licenses/.
 */
package org.braintrain.domain;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

/**
 * A log of a completed test.  This Object is stored when a test is completed
 * and contains all the information related to the user, test, and module.
 * 
 * @author John Ericksen
 *
 */

@Entity
@Table( name="braintrain_test_log" )
public class TestLog extends BrainTrainBase {

    private static final long serialVersionUID = 4195088456419191194L;
    
    private User user;
    private int score;
    private int numberOfQuestions;
    private Date completionDate;
    private TestData test;
    private Module module;
    
    public Date getCompletionDate() {
        return completionDate == null ? null : (Date) completionDate.clone();
    }
    public void setCompletionDate(Date completionDate) {
        this.completionDate = completionDate;
    }
    public int getScore() {
        return score;
    }
    public void setScore(int score) {
        this.score = score;
    }
    @ManyToOne(fetch=FetchType.LAZY)
    public User getUser() {
        return user;
    }
    public void setUser(User user) {
        this.user = user;
    }
    public int getNumberOfQuestions() {
        return numberOfQuestions;
    }
    public void setNumberOfQuestions(int numberOfQuestions) {
        this.numberOfQuestions = numberOfQuestions;
    }
    
    @ManyToOne(fetch=FetchType.LAZY)
    public TestData getTest() {
        return test;
    }
    public void setTest(TestData test) {
        this.test = test;
    }
    
    @ManyToOne(fetch=FetchType.LAZY)
    public Module getModule() {
        return module;
    }
    public void setModule(Module module) {
        this.module = module;
    }
    
}
